class Solution {
    public int[] exchange(int[] nums) {
        int len = nums.length;
        if(0 == len || 1 == len) {
            return nums;
        }
        int slow = 0;
        int fast = 0;
        //把slow放到第一个为偶数的地方
        while(fast < len) {
            while(slow < len && 0 != nums[slow] % 2) {
            slow++;
            }
            if(fast < slow) {
                fast = slow;
            }
            if(fast < len && 1 == nums[fast] % 2) {
                temp(nums,fast,slow);
            }
            fast++;
        }
        return nums;
    }
    private void temp(int[] nums,int fast,int slow) {
        int tem = nums[fast];
        nums[fast] = nums[slow];
        nums[slow] = tem;
    }
}